<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>v-show v-if的指令</title>
    <script src="./js/vue.js"></script>
</head>
<body>
    <div id="app">
        <h1>{{msg}}</h1>
        <!-- <img src="./imgs/OIP-C.jpg" width="200" v-show="true"> -->
        <img src="./imgs/OIP-C.jpg" width="200" v-if="show">
        <button @click="changeShow">{{btnText}}</button>
    </div>
</body>
</html>
<script>
    var app = new Vue({
        el: '#app',
        data: {
            msg: 'v-show v-if的指令',
            show: false,
            btnText: '显示'
        },
        methods: {
            changeShow(){
                this.show = !this.show
                // if(this.show){
                //     this.btnText = '隐藏'
                // }else{
                //     this.btnText = '显示'
                // }
                this.btnText = this.show ? '隐藏' : '显示'
            }
        }
    })

</script>